Page({
  data: {
    classFreeListenData: [
      {
        id: '0',
        type: '教室借用',
        time: '2018-12-16 17:00',
        status: '未审核',
        statusColor: 'orange'
      },
      {
        id: '1',
        type: '课程免听',
        time: '2018-12-17 17:00',
        status: '未审核',
        statusColor: 'orange'
      },
      {
        id: '2',
        type: '课程替换',
        time: '2018-12-18 17:00',
        status: '未审核',
        statusColor: 'orange'
      }
    ]
  },
  onLoad () {
    this.setData({
      userInfo: wx.getStorageSync('userInfo')
    })
    const userId = this.data.userInfo.userId
    if (userId === '00000000') {
      this.setData({
        'classFreeListenData[0].status': '未审核',
        'classFreeListenData[1].status': '未审核',
        'classFreeListenData[2].status': '未审核'
      })
    } else if (userId === '88888888') {
      this.setData({
        'classFreeListenData[0].status': '未审核',
        'classFreeListenData[1].status': '未审核',
        'classFreeListenData[2].status': '未审核'
      })
    } else {
      this.setData({
        'classFreeListenData[0].status': '学院未审核 → 教务未审核',
        'classFreeListenData[1].status': '学院未审核 → 教务未审核',
        'classFreeListenData[2].status': '学院未审核 → 教务未审核'
      })
    }
  },
  applyFreeListen (e) {
    const id = e.currentTarget.dataset.details.id
    wx.navigateTo({
      url: `/pages/person/approval/approvalDetails/index?id=${id}`
    })
  }
})